<template>
    <div class="AddNewMatch">
      <div class="UploadLogo">
        <div style="width: 10%; line-height: 42px;">赛事logo ：</div>
        <div>
          <el-upload
            action="https://jsonplaceholder.typicode.com/posts/"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog :visible.sync="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="">
          </el-dialog>
          <div style="color: #8F8F8F;font-size: 14px; text-align: center;">只支持.jpg .png格式</div>
        </div>
      </div>
        <div class="MatchInfoOne">
          <div class="MatchName">
            <div class="NameFont">赛事名称 ：</div>
            <el-input v-model="MatchName" placeholder="xxx2018超级联赛" class="InputSize"></el-input>
          </div>
          <div class="MatchReferee">
            <div class="NameFont">指派裁判长 ：</div>
            <el-input v-model="MatchReferee" placeholder="158888888888" style="width: 40%"></el-input>
            <div style="width: 20%;line-height: 42px;margin-left: 5%;">张三</div>
          </div>
        </div>
        <div class="MatchInfoTwo">
          <div class="MatchOrganization">
            <div class="NameFont">主办单位 ：</div>
            <el-input v-model="MatchOrganization" placeholder="xxx2018超级联赛" class="InputSize"></el-input>
          </div>
          <div  class="MatchAssisstOrganization">
            <div class="NameFont">协办单位 ：</div>
            <el-input v-model="MatchAssisstOrganization" placeholder="15888888888" class="InputSize"></el-input>
          </div>
        </div>
        <div  class="MatchInfoThree">
          <div  class="MatchLocation">
            <div class="NameFont">比赛地点 ：</div>
            <el-input v-model="MatchLocation" placeholder="武汉市洪山区珞喻路武汉体育学院" class="InputSize"></el-input>
          </div>
          <div  class="MatchContactor">
            <div class="NameFont">赛事联络人 ：</div>
            <el-input v-model="MatchContactor" placeholder="1588888888(张老师)" class="InputSize"></el-input>
          </div>
        </div>
      <div class="series">
        <div style=" align-items: baseline; display: flex;  width: 45%;">
        <div class="NameFont">是否为系列赛 ：</div>
        <el-radio-group v-model="radio" style="width:75%;">
          <el-radio :label="1">单次赛事</el-radio>
          <el-radio :label="2">选择系列赛</el-radio>
          <el-radio :label="3">上传竞赛规程</el-radio>
        </el-radio-group>
        </div>
        <div v-show="radio==2" class="ChooseSeries">
          <div class="NameFont">选择系列赛 ：</div>
            <el-select v-model="SerierSelect" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
           </el-select>
        </div>
      </div>
      <div class="UploadRules">
        <div class="NameFont">上传竞赛规程 ：</div>
        <div>
          <el-upload
            class="upload-demo"
            action="https://jsonplaceholder.typicode.com/posts/"
            :on-change="handleChange"
            :limit="3"
            :before-upload="beforeAvatarUpload"
            :file-list="PdfList">
            <el-button size="small" type="primary">点击上传</el-button>
            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
          </el-upload>
        </div>
      </div>
      <div style="justify-content: center;display: flex;margin-top: 30px;">
        <el-button round style="width: 200px" type="primary">提交</el-button>
      </div>
    </div>
</template>

<script>
    export default {
        name: "AddNewMatch",
      data(){
          return{
            MatchName:'',
            MatchReferee:'',
            MatchOrganization:'',
            MatchAssisstOrganization:'',
            MatchLocation:'',
            MatchContactor:'',
            radio: 1,
            options: [{
              value: '1',
              label: 'xxx2018超级联赛武汉站'
            }, {
              value: '2',
              label: 'xxx2018超级联赛上海站'
            }, {
              value: '3',
              label: 'xxx2018超级联赛北京站'
            },],
            SerierSelect:'',
            dialogImageUrl: '',
            dialogVisible: false,
            PdfList:[],
          }
      },
      methods:{
        handleRemove(file, fileList) {
          console.log(file, fileList);
        },
        handlePictureCardPreview(file) {
          this.dialogImageUrl = file.url;
          this.dialogVisible = true;
        },
        beforeAvatarUpload(file){
          const isPDF = file.type=='application/pdf'
          console.log(isPDF)
          console.log(file.type)
        },
        handleChange(file, fileList) {
          this.PdfList = fileList.slice(-3);
        }
      },
    }
</script>

<style scoped>
.AddNewMatch{
  width: 90%;
  height: 800px;
  margin-top: 50px;
  margin-left: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.UploadLogo{
    display: flex;
}
.MatchInfo{
    display: flex;
    flex-direction: column;
}
.MatchInfoOne{
    display: flex;
    justify-content: space-between;
}
.MatchName{
  width: 45%;
  display: flex;
}
.MatchReferee{
  width: 45%;
  display: flex;
}
.MatchInfoTwo{
    display: flex;
  justify-content: space-between;
}
.MatchOrganization{
  width: 45%;
  display: flex;
}
.MatchAssisstOrganization{
  width: 45%;
  display: flex;
}
.MatchInfoThree{
    display: flex;
  justify-content: space-between;
}
.MatchLocation{
  width: 45%;
  display: flex;
}
.MatchContactor{
  width: 45%;
  display: flex;
}
.series{
  display: flex;
  justify-content: space-between;
}
.ChooseSeries{
  display: flex;
  width: 45%;
}
.UploadRules{
  display: flex;
}
  .NameFont{
    width: 20%;
    line-height: 42px;
  }
  .InputSize{
    width: 65%;
    height: 42px;
  }
</style>
